<?php

namespace app\common\model;

use think\Model;

class Level extends Model
{
    protected $name = 'level_think';

    protected $autoWriteTimestamp = true;

    public static function getAll($request)
    {
        try {
            // $that = parent::where($map);
            return parent::paginate(10, false, ['query' => $request->get()]);
               

        } catch (\Exception $e) {

            return [];
        }
    }


    public function edit($param, $admin)
    {
        try {
            $param['rec1'] = $param['rec1'] / 100;
            $param['rec2'] = $param['rec2'] / 100;
            

            parent::update($param, true);

            Logs::adds('修改等级', $admin->id, $admin['username']);

            return json(['status' => 1, 'message' => '已保存']);

        } catch (\Exception $e) {
            return json(['status' => -1, 'message' => $e->getMessage()]);
        }
    }

}

